package com.example.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.pojo.entity.Team;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface TeamMapper extends BaseMapper<Team> {


    @Select("SELECT t.name, COUNT(p.id) project_count, (select COUNT(p.id) from project p, team t WHERE p.`status` = 4 and p.team_id = t.id and t.`name`=#{name} )/COUNT(p.id) proportion\n" +
            "from project p JOIN team t on p.team_id = t.id\n" +
            "WHERE t.`name`=#{name}\n" +
            "ORDER BY COUNT(p.id) DESC;\n")
    Map<String, Object> selectCountByName(String name);
}
